﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class Test_testRedon : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
            Single nvalor = Convert.ToSingle(TextBox1.Text);
            int Entero = (int)nvalor;
            float dec = (nvalor - (int)nvalor);
            if (Entero >= 6 && Entero < 10)
            {
                if (dec >= 0 && dec <= 0.25)
                    dec = 0;
                if (dec >= 0.26 && dec <= 0.75)
                    dec = 0.5F;
                if (dec > 0.75)
                {
                    dec = 0;
                    Entero += 1;
                }
            }
            else
            {
                    if (dec > 0 && dec <= 0.5)
                        dec = 0F;
                    if (dec > 0.5 )
                    {
                        dec = 0;
                        Entero += 1;
                    }
               
            }
            nvalor = Entero + dec;
    }
}
